package com.showcai.controller.projectileFrame;

import com.github.pagehelper.PageInfo;
import com.showcai.controller.base.BaseController;
import com.showcai.def.Constant;
import com.showcai.module.Product;
import com.showcai.module.ProjectileFrame;
import com.showcai.result.ResultObj;
import com.showcai.result.ReturnCode;
import com.showcai.service.ProjectileFrameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.Map;

@RequestMapping("/projectileFrame")
@Controller
public class ProjectileFrameContorller extends BaseController {

    @Autowired
    ProjectileFrameService projectileFrameService;

    @RequestMapping(value = "/projectileFramePage")
    public ModelAndView projectileFramePage() {
        ModelAndView mov = new ModelAndView();
        ProjectileFrame projectileFrame = projectileFrameService.selectprojectileFrame();
        mov.setViewName("/projectileFrame/projectileFrameList");
        mov.addObject("projectileFrame",projectileFrame);
        return mov;
    }
    @RequestMapping(value = "/projectileFrame")
    @ResponseBody
    public String projectileFrame(ProjectileFrame projectileFrame) {
        projectileFrameService.changeStatus(projectileFrame);
        ResultObj resultObj = new ResultObj();
        resultObj.setCode(ReturnCode.SUCCESS.getCode());
        resultObj.setMsg(ReturnCode.SUCCESS.getMsg());
        return resultObj.toJson();
    }
}
